package study;

import java.util.List;
import java.util.Optional;

/**
 * @Author 金贵权
 * @Date 2023/6/12 16:09
 **/
public class StreamDemo01 {
    public static void main(String[] args) {
        List<User> userList = Utils.getUserList();
        boolean b = userList.stream().noneMatch(x -> x.getId() > 9);
        System.out.println(b);

        Optional<User> any = userList.stream().filter(x -> x.getId() > 1).findAny();
        System.out.println(any);
        userList.stream().filter(x->x.getId()>1).findAny().ifPresent(System.out::println);
    }
}
